import datetime
import os


def gat_now_time():
    return datetime.datetime.now()


def gat_project_path():
    """
    获取项目绝对路径
    :return:返回项目的绝对路径
    """
    project_name = "WorkSelenium"
    # 获取当前路径
    file_path = os.path.dirname(__file__)
    return file_path[:file_path.find(project_name)] + project_name
    # print(file_path.find(project_name))
    # print(file_path[:file_path.find(project_name)] + project_name)


def sep(path, add_sep_before=False, add_sep_after=False):
    """

    :param path:项目路径
    :param add_sep_before:是否在后面添加分隔符
    :param add_sep_after:是否在前面添加分隔符
    :return:
    """
    all_path = os.sep.join(path)
    if add_sep_before:
        all_path = os.sep + all_path
    if add_sep_after:
        all_path = all_path + os.sep
    return all_path


if __name__ == '__main__':
    gat_project_path()
    sep(["测试", "python.py"])
